package com.example.thread2.thread6;


import static jdk.nashorn.internal.objects.Global.print;

public class InnerThread1 {
    private int coutDown = 5;
    private Inner inner;
    private class Inner extends Thread {
        Inner(String name) {
            super(name);
            start();
        }
        public void run() {
            try {
                while (true){
                    print(this);
                    if(--coutDown == 0) {
                        return;
                    }
                    sleep(10);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        public String toString(){
            return getName() + ": " + coutDown;
        }
    }
    public InnerThread1(String name) {
        inner = new Inner(name);
    }
}